package cn.tedu.io.serial;

import java.io.Serializable;
//类实现Serializable接口才能对象才能做序列化
public class Person implements Serializable {

    //java计算版本号，指定版本号
    private static final long serialVersionUID = 6425645969474214554L;

    //指定版本号，不会再去计算版本号，保证前后版本号一致
    //private static final long serialVersionUID=3278546L;

    //私有化属性
    private String name;
    private int age;
    //属性会随着对象一起进行序列化
    private char gender;
    private double height;
    //静态属性不能被序列化过去
    //private static String classroom;
    //强制属性不会被序列化过去
    //private transient double weight;

    //方法不会被序列化
    //public void m(){}

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
